-
Notifications
You must be signed in to change notification settings - Fork 671
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Reintroduce k8s client fallback to cache lookups #4733
Conversation
Signed-off-by: Daniel Rammer <[email protected]>
Signed-off-by: Daniel Rammer <[email protected]>
Signed-off-by: Daniel Rammer <[email protected]>
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## master #4733 +/- ##
==========================================
- Coverage 58.20% 58.19% -0.02%
==========================================
Files 626 626
Lines 53800 53833 +33
==========================================
+ Hits 31316 31327 +11
- Misses 19976 20000 +24
+ Partials 2508 2506 -2
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
Signed-off-by: Daniel Rammer <[email protected]>
Signed-off-by: Daniel Rammer <[email protected]>
Just to confirm my understanding. Does it mean this comment is not correct without this PR? |
@honnix correct, previous to this merge it was and ti will be again after we get this PR merged. Right now, we only look at the informer cache and do not fall back to the api reader. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lgtm
func NewFallbackClientBuilder(scope promutils.Scope) *FallbackClientBuilder { | ||
return &FallbackClientBuilder{ | ||
scope: scope, | ||
func (c fallbackClientReader) List(ctx context.Context, list client.ObjectList, opts ...client.ListOption) (err error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I remember this code
This comment successfully tricked me not to look further into client details, lol. |
Tracking issue
fixes #4730
Why are the changes needed?
This PR updated k8s and removed the logic to fallback to the client
Reader
when the cacheReader
was a miss. In high traffic scenarios the k8s informer can not populate the cache fast enough, so the fallback API call is required to ensure correctness.What changes were proposed in this pull request?
Creating the k8s client with a fallback to API call when an object does not exist in the informer cache.
How was this patch tested?
Faked an object
NotFound
error because of cache miss.Setup process
Updated k8s client and cache through the otel wrapper to fail retrievals if the object was created less than 3 seconds ago. Example code:
Then validated that this causes Pods to be stuck in
Terminating
state with finalizers still intact:with log
and UI message
[3/3] currentAttempt done. Last Error: SYSTEM::resource not found, name [flytesnacks-development/f5329181f1364487b8a9-n0-3]. reason: bar.foo "f5329181f1364487b8a9-n0-3" not found
Screenshots
NA
Check all the applicable boxes
Related PRs
NA
Docs link
NA